package com.hong.qrpc.strategy.register;
import com.hong.config.constant.ClientConfig;
import com.hong.qrpc.RpcClient;
import com.hong.qrpc.config.RegisterConfig;
import com.hong.qrpc.strategy.PropertiesStrategy;
import com.hong.qrpc.utils.StringUtils;

/**
 * @Author HQT
 * @Date 2022/7/23 19:22
 */
public class DiscoverServiceAddrStrategy implements PropertiesStrategy {
    @Override
    public void disposeProperties(RpcClient rpcClient) {
        String addrs = (String) rpcClient.getConfigManager().getProfile().get(ClientConfig.QRPC_DISCOVER_SERVICE_ADDR);
        if(!StringUtils.isEmpty(addrs)){
            RegisterConfig registerConfig = rpcClient.getConfigManager().getRegisterConfig();
            registerConfig.setRegisterAddrs(addrs);
        }
    }
}
